<template>
	<div class="myself-shop">
	  <back :title="title"></back>
	  <div class="contents">
	  <div class="goodList">
	  	 <div class="shopInfo" @click="goInfo">
	  	 	 <img :src="shop.shopImg" class="shopImg" />
	  	 	 <div class="shop">
	  	 	 	<p class="shopName">{{shop.shopName}}</span></p>
	  	        <p class="detailAddress">{{area}}{{shop.detailAddress}}</span></p>
	  	 	 </div>
	  	 </div>
	  	  <div class="writeShop" @click="Cancellation(shop.id)">注销</div>
	  	  <div class="editShop" @click="eidtShop(shop.id)">修改</div>
	  	 </div> 
	  </div> 
	<!--  <add-shop v-show="isShow" @close="close"></add-shop>-->
	</div>
</template>

<script>          
import back from '@/components/m-shop/m-store/back'
import addShop from '@/components/m-shop/m-store/addshop'

export default {
	name: 'myself-shop',
	components: {
		back,
		addShop
	},
	data() {
		return {
			title: '店铺信息',
			shop: {},
			address:'',
			area:'',
			isShow: false
		}
	},
	created () {
		this.getShop()
	},
	mounted() {
		
	},
	methods: {
		//获取所有店铺
		getShop() {
			this.$http.get(this.$store.state.reqUrl + this.$route.query.shop_url + '/'+ this.$store.state.shop_id, {
			}).then(res => {
				this.shop = res.data;
				this.area = res.data.area.areaName+res.data.area.childArea.areaName+res.data.area.childArea.childArea.areaName;
				
			})
		},
		//修改信息；
		eidtShop(id) {
			this.$router.push({
				path: '/editshop',
				query: {
					shop_id: id,
					isShopShow: true
				}
			})
		},
		//注销
		Cancellation(id) {
			this.$messagebox.confirm('确定注销吗?').then(action => {
				this.$http.get(this.$store.state.reqUrl + 'shops/info/' + id, {}).then(res => {
					this.$router.push("/shop")
					this.$toast({
						message: res.data.msg,
						duration: 2000
					})
				}).catch(res => {
					this.$toast(res.response.data)
				})
			});
		},
		//到店铺详情页
		goInfo () {
			this.$router.push({
				path:'/stock',
				query:{
					shop_url:'/shops/stock',
				}
			})
		}
	}
}
</script>

<style lang="less" scoped>
     .myself-shop {
     	margin-top:100px;
     	.contents {
     		width:100%;
     		.goodList {
     			font-size: 28px;
     			background: #FFFFFF;
     			overflow-x: hidden;
     			padding: 20px 30px;   
     			.shopInfo{
     				padding-bottom: 30px;
     				justify-content: center;
     				align-content: center;
     				display:-webkit-box;
     				.shopImg{
     					width:200px;
     					height: 200px;
     				}
     				.shop{
     					flex: 1;
     					margin-left: 20px;
     					.shopName{
     						font-size: 32px;
     						margin-bottom: 30px;
     						color: #000000;
     					}
     					.detailAddress{
     						font-size: 28px;
     					}
     				}
     			} 			
     			.writeShop {
     				float: right;
     				height: 60px;
     				width: 150px;
     				line-height: 60px;
     				text-align: center;
     				border-radius: 38px;
     				border: 1px solid gainsboro;
     				color: #000000;
     			}
     			.editShop {
     				float: right;
     				height: 60px;
     				width: 150px;
     				line-height: 60px;
     				text-align: center;
     				border-radius: 38px;
     				border: 1px solid gainsboro;
     				color: #000000;
     				margin-right: 20px;
     			}
     		}
     	}
     }
</style>